package com.framework.plm.sec.encoder;

import org.springframework.security.authentication.encoding.MessageDigestPasswordEncoder;

/**
 * 哈希算法(SHA)加密类
 *
 */

public class SHAPasswordEncoder extends MessageDigestPasswordEncoder  implements IPasswordEncoder{

    /**
     * Initializes the ShaPasswordEncoder for SHA-1 strength
     */
    public SHAPasswordEncoder() {
        this(1);
    }

    public   String encode(String pwd)
    {
    	return encodePassword(pwd, "");
    }
    /**
     * Initialize the ShaPasswordEncoder with a given SHA stength as supported by the JVM
     * EX: <code>ShaPasswordEncoder encoder = new ShaPasswordEncoder(256);</code> initializes with SHA-256
     *
     * @param strength EX: 1, 256, 384, 512
     */
    public SHAPasswordEncoder(int strength) {
        super("SHA-" + strength);
    }
}
